
#include "RTQueue.h"

#define TQUEUE_MAX_SIZE       20

static TQueueItem   TQueue[TQUEUE_MAX_SIZE]  = {0};


int TQ_Add(uint8_t* context, size_t size)
{
	int i  = 0;
	for(; i < TQUEUE_MAX_SIZE; i++)	{
		if( TQueue[i].state == TQ_EMPTY)	{
			TQueue[i].size  = size;
			TQueue[i].context  = (uint8_t*)	malloc(size);
			memcpy(TQueue[i].context, context, size);
			TQueue[i].state  = TQ_CRETE;
		}		
	}
}

